Skip to content

[flink] Flink batch read based on SST merge. - #3677

Open
loserwang1024 wants to merge 1 commit into
apache:mainfrom
loserwang1024:batch-read
Open

[flink] Flink batch read based on SST merge.#3677
loserwang1024 wants to merge 1 commit into
apache:mainfrom
loserwang1024:batch-read

Conversation

@loserwang1024

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close http://github.com/apache/fluss/issues/3656

Brief change log

Tests

API and Format

Documentation

@loserwang1024

Copy link
Copy Markdown
Contributor Author

@fresh-borzoni @leonardBang @beryllw , CC

@loserwang1024
loserwang1024 force-pushed the batch-read branch 2 times, most recently from 18edf1f to a9044ac Compare July 20, 2026 10:02

@naivedogger naivedogger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @loserwang1024 for the PR! Overall looks good to me — left a few comments, PTAL.

IOUtils.closeQuietly(logScanner);
}

private static ProjectionPlan createProjectionPlan(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is logically identical to LakeSnapshotAndLogSplitScanner#getNeedProjectFields(pk-column completion + adjustProjectedFields mapping, just packaged differently). Maybe worth extracting into a shared helper in this package so future fixes don't need to be applied twice?

return true;
}

CloseableIterator<InternalRow> snapshotRows = snapshotScanner.pollBatch(timeout);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initializeSnapshotIterator calls snapshotScanner.pollBatch() only once and treats the returned iterator as the complete snapshot stream. This assumes a single pollBatch returns the whole snapshot, which holds for KvSnapshotBatchScanner today but violates the poll-until-null contract of BatchScanner — a chunked implementation would silently lose data. Could we make SnapshotRecordIterator lazily poll until pollBatch returns null? If the underlying scanner ever becomes chunked (like KvBatchScanner), this would silently drop snapshot data.

import static org.apache.fluss.utils.Preconditions.checkArgument;

/**
* The hybrid split for first reading the snapshot files and then switch to read the cdc log from a

@naivedogger naivedogger Jul 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the class javadoc still only describes the streaming two-phase behavior ("first reading the snapshot files and then switch to read the cdc log"). Since this split now also models bounded batch reads (merged snapshot + bounded log, possibly with no snapshot at all via NO_SNAPSHOT_ID), could we update the javadoc and add a doc for the NO_SNAPSHOT_ID semantics?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants